package com.example.easy.mapper;

import com.example.easy.Dto.FoodSafety;
import com.example.easy.Dto.MessageBoard;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface MessageBoardMapper {

    @Insert("Insert into massage_board (number,username,content,time)Values(#{number},#{username},#{content},#{time})")
    int insMessageBoard(MessageBoard messageBoard);//插入（留言）

    @Update("UPDATE massage_board  SET reply=#{reply} WHERE number=#{number}")
    int reply(MessageBoard messageBoard);//修改（回复）

    @Select("SELECT * FROM massage_board  WHERE username=#{username} ")
    List<MessageBoard>  select(String username);//查看个人的所有留言

    @Select("SELECT * FROM massage_board ")
    List <MessageBoard> selectall();//查看所有留言

    @Select("SELECT * FROM massage_board  WHERE reply IS NULL ")
    List<MessageBoard> selectreply();//查看所有未被回复的留言

    @Select("SELECT * FROM massage_board  WHERE number='2' AND reply IS NULL")
    int selectnull(int number);//查看某条留言的回复字段是否为空



}
